package red_book.year2024.month4;

import java.util.*;

public class FansSelect {
    public static class Fan{
        int id;
        int fansHigh;
        Fan(int id,int fansHigh){
            this.id=id;
            this.fansHigh=fansHigh;
        }
    }
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        int fansNum=sc.nextInt();
        int selectFans=sc.nextInt();
        List<Fan> fans=new ArrayList<>(fansNum);
        for(int i=0;i<fansNum;i++){
            int a=sc.nextInt();
            int b=sc.nextInt();
            fans.add(new Fan(i+1,a+b*2));
        }
        Collections.sort(fans,(a,b)->{
            if(a.fansHigh<b.fansHigh){
                return 1;
            }else if(a.fansHigh>b.fansHigh){
                return -1;
            }else {
                return a.id-b.id;
            }
        });
        TreeSet<Fan> fansSelect=new TreeSet<>((a,b)->{
            return a.id-b.id;
        });
        for (int i = 0; i < selectFans; i++) {
            fansSelect.add(fans.get(i));
        }
        Iterator<Fan> iterator = fansSelect.iterator();
        while (iterator.hasNext()){
            Fan next = iterator.next();
            System.out.print(next.id);
            if(iterator.hasNext()){
                System.out.print(" ");
            }
        }
    }
}
